/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.fee.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.modules.sys.entity.Office;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * 应收结算单Entity
 * @author weisong
 * @version 2017-09-22
 */
public class Receivables extends DataEntity<Receivables> {
	
	private static final long serialVersionUID = 1L;
    public static final int updateStatus1 = 1;        //已确认
    public static final int updateStatus2 = 2;        //部分开票
    public static final int updateStatus3 = 3;        //全部开票
    public static final int updateStatus4 = 4;        //部分核销
    public static final int updateStatus5 = 5;        //全部核销
    public static final int CLOSED = 6;        //已关闭
	private String clearingNo;		// 结算单号
	private Date busyDate;		// 结算日期
	private Integer status;		// 状态
	private Consignor payerName;		// 结算方
	private Double payMoney;		// 结算金额
	private Double invoiceMoney;		// 开票金额
	private Double vcaMoney;		// 核销金额
	private Double noInvoiceMoney;		// 未开票金额
	private Double noVcaMoney;		// 未核销金额
	private String closeReason;		// 关闭原因
	private Office logistics;		// 物流组织

    //非数据库字段 结算单关联的订单（数据源页面直接选择订单生成结算单，没有经过明细）
    private List<ReceiveTip> tips;

    //供查询使用
    private Date startDate;		// 开始时间
    private Date endDate;		// 结束时间
	
	public Receivables() {
		super();
	}

	public Receivables(String id){
		super(id);
	}

	@ExcelField(title="结算单号", align=2, sort=6)
	public String getClearingNo() {
		return clearingNo;
	}

	public void setClearingNo(String clearingNo) {
		this.clearingNo = clearingNo;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message="结算日期不能为空")
	@ExcelField(title="结算日期", align=2, sort=7)
	public Date getBusyDate() {
		return busyDate;
	}

	public void setBusyDate(Date busyDate) {
		this.busyDate = busyDate;
	}
	
	@NotNull(message="状态不能为空")
	@ExcelField(title="状态", dictType="receivables_status", align=2, sort=8)
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@NotNull(message="结算方不能为空")
	@ExcelField(title="结算方", fieldType=Consignor.class, value="", align=2, sort=9)
	public Consignor getPayerName() {
		return payerName;
	}

	public void setPayerName(Consignor payerName) {
		this.payerName = payerName;
	}
	
	@NotNull(message="结算金额不能为空")
	@ExcelField(title="结算金额", align=2, sort=10)
	public Double getPayMoney() {
		return payMoney;
	}

	public void setPayMoney(Double payMoney) {
		this.payMoney = payMoney;
	}
	
	@ExcelField(title="开票金额", align=2, sort=11)
	public Double getInvoiceMoney() {
		return invoiceMoney;
	}

	public void setInvoiceMoney(Double invoiceMoney) {
		this.invoiceMoney = invoiceMoney;
	}
	
	@ExcelField(title="核销金额", align=2, sort=12)
	public Double getVcaMoney() {
		return vcaMoney;
	}

	public void setVcaMoney(Double vcaMoney) {
		this.vcaMoney = vcaMoney;
	}
	
	@ExcelField(title="未开票金额", align=2, sort=13)
	public Double getNoInvoiceMoney() {
		return noInvoiceMoney;
	}

	public void setNoInvoiceMoney(Double noInvoiceMoney) {
		this.noInvoiceMoney = noInvoiceMoney;
	}
	
	@ExcelField(title="未核销金额", align=2, sort=14)
	public Double getNoVcaMoney() {
		return noVcaMoney;
	}

	public void setNoVcaMoney(Double noVcaMoney) {
		this.noVcaMoney = noVcaMoney;
	}
	
	@ExcelField(title="关闭原因", align=2, sort=15)
	public String getCloseReason() {
		return closeReason;
	}

	public void setCloseReason(String closeReason) {
		this.closeReason = closeReason;
	}
	
	@ExcelField(title="物流组织", fieldType=Office.class, value="logistics.name", align=2, sort=16)
	public Office getLogistics() {
		return logistics;
	}

	public void setLogistics(Office logistics) {
		this.logistics = logistics;
	}

    public List<ReceiveTip> getTips() {
        return tips;
    }

    public void setTips(List<ReceiveTip> tips) {
        this.tips = tips;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
}